package frame.options.simulation.create.backup;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Insets;

import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.border.EmptyBorder;

@SuppressWarnings("serial")
public class BackupPanel extends JPanel
{
	private JRadioButton noRadioButton;
	public JRadioButton getNoRadioButton(){ return noRadioButton; }
	public void setNoRadioButton( JRadioButton noRadioButton ){ this.noRadioButton = noRadioButton; }
	
    private JRadioButton yesRadioButton;
    public JRadioButton getYesRadioButton(){ return yesRadioButton; }
	public void setYesRadioButton( JRadioButton yesRadioButton ){ this.yesRadioButton = yesRadioButton; }
	
    public BackupPanel()
    {
    	this.setNoRadioButton( new JRadioButton( "No" ) );
        this.getNoRadioButton().setSelected( true );
        
        this.setYesRadioButton( new JRadioButton( "Yes" ) );
        this.getYesRadioButton().setSelected( false );
        
		ButtonGroup buttonGroup = new ButtonGroup();
        buttonGroup.add( this.getNoRadioButton() );
        buttonGroup.add( this.getYesRadioButton() );
    	
        this.setLayout( new BorderLayout() );
        this.add( this.titlePanel(), BorderLayout.NORTH );
        this.add( this.contentPanel(), BorderLayout.CENTER );
    }
    
    private JPanel titlePanel()
    {
    	JLabel titleLabel = new JLabel( "Virtual networks with backup" );
        titleLabel.setFont( new Font( "MS Sans Serif", Font.BOLD, 14 ) );
        titleLabel.setBorder( new EmptyBorder( new Insets( 10, 10, 10, 10 ) ) );
        titleLabel.setOpaque( true );
        
        JSeparator separator = new JSeparator();
        
        JPanel titlePanel = new JPanel();
        titlePanel.setLayout( new java.awt.BorderLayout() );
        titlePanel.setBackground( Color.gray );
        titlePanel.add( titleLabel, BorderLayout.CENTER );
        titlePanel.add( separator, BorderLayout.SOUTH );
        
        return titlePanel;
    }
    
    private JPanel contentPanel()
	{
        JPanel contentPanel = new JPanel();
        contentPanel.setBorder( new EmptyBorder( new Insets( 50, 50, 50, 50 ) ) );
        contentPanel.add( this.selectPanel() );
        
        return contentPanel;
	}
    
    private JPanel selectPanel()
	{
        JPanel selectPanel = new JPanel();
        selectPanel.setLayout( new java.awt.GridLayout( 0, 1 ) );
        selectPanel.add( this.getNoRadioButton() );
        selectPanel.add( new JLabel() );
        selectPanel.add( this.getYesRadioButton() );
        selectPanel.add( new JLabel() );
        
        return selectPanel;
	}
    
}
